<template>
	<view class="content">
		<view class="content_list" v-for="(v,k) in dataList" :key="k" @click="go(v.userbid)">
			<image class="img" mode="aspectFit" :src="v.friendsheaderimg"></image>
			<view class="right">
				<view class="name"><text class="text1">{{v.name}}</text><text class="text2">{{v.msgtxt}}</text></view>
				<view class="shop">{{v.company}}</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {link} from '@/utils/utils.js'
	import {
		ref
	} from 'vue'
	import {
		onLoad,
		onShow
	} from '@dcloudio/uni-app'
	import {
		homeApi
	} from "@/api/index"
	onLoad(()=>{
		getData()
	})
	const dataList = ref([])
	const getData = async()=>{
		let data = {
			do:'txlmyfriends'
		}
		let res = await homeApi.publicGet(data)
		for (let i = 0; i < res.columns.length; i++) {
			if (res.columns[i].name == 'txlmyfriends') {
				dataList.value = res.columns[i].friends?res.columns[i].friends:[]
			}
		}
	}
	const go = (id)=>{
		if(id!=''){
			link('/comm/new/new?id='+id)
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		width: 100%;
		&_list{
			width: calc(100% - 60rpx);
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding-left: 30rpx;
			padding-right: 30rpx;
			.img{
				width: 120rpx;
				height: 120rpx;
				border-radius: 100%;
			}
			.right{
				border-bottom:1px solid #f5f6fa;
				width: calc(100% - 150rpx);
				height: 120rpx;
				padding-top: 30rpx;
				padding-bottom: 30rpx;
				display: flex;
				justify-content: center;
				flex-direction: column;
				.name{
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: space-between;
					.text1{
						font-size: 32rpx;
						font-weight: bold;
					}
					.text2{
						font-size: 28rpx;
						color: #888;
					}
				}
				.shop{
					font-size: 28rpx;
					color: #999;
					margin-top: 10rpx;
				}
			}
		}
	}
</style>